﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Settings;

namespace PanasonicWarranty.Business
{
    public partial class SmsShortCode
    {
        public static SmsShortCode GetByShortCode(string shortCode)
        {
            using (DBSmsDataContext context = new DBSmsDataContext(AppSetting.ConnectionString))
            {
                return context.SmsShortCodes.FirstOrDefault(p => p.ShortCode == shortCode);
            }
        }

        public static string GetMtType(string shortCode)
        {
            SmsShortCode objshortcode = GetByShortCode(shortCode);
            if (objshortcode != null)
                return objshortcode.MTType;
            return AppSetting.DefaultMtType;
        }

        public static List<SmsShortCode> GetAll()
        {
            using (DBSmsDataContext context = new DBSmsDataContext(AppSetting.ConnectionString))
            {
                return context.SmsShortCodes.ToList();
            }
        }
    }
}
